package com.betterjr.modules.risk.loanmanage.entity;

import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.betterjr.common.annotation.MetaData;
import com.betterjr.common.entity.BetterjrEntity;

@Access(AccessType.FIELD)
@Entity
@Table(name = "t_loan_data")
public class LoanData implements BetterjrEntity {
    public static final String selectKey = "LoanData.id";
    /**
     * ID
     */
    @Id
    @Column(name = "ID", columnDefinition = "INTEGER")
    @MetaData(value = "ID", comments = "ID")
    private Long id;

    /**
     * 合同ID
     */
    @Column(name = "P_CONTRACT_ID", columnDefinition = "INTEGER")
    @MetaData(value = "合同ID", comments = "合同ID")
    private Long contractId;

    /**
     * 合同名称
     */
    @Column(name = "C_CONTRACT_NAME", columnDefinition = "VARCHAR")
    @MetaData(value = "合同名称", comments = "合同名称")
    private String contractName;

    /**
     * 合同号
     */
    @Column(name = "C_CONTRACT_NO", columnDefinition = "VARCHAR")
    @MetaData(value = "合同号", comments = "合同号")
    private String contractNo;

    /**
     * 供应商
     */
    @Column(name = "C_SUPPLIER_NAME", columnDefinition = "VARCHAR")
    @MetaData(value = "供应商", comments = "供应商")
    private String supplierName;

    /**
     * 供应商代码
     */
    @Column(name = "C_SUPPLIER_NO", columnDefinition = "VARCHAR")
    @MetaData(value = "供应商代码", comments = "供应商代码")
    private String supplierNo;

    /**
     * 供应商ID
     */
    @Column(name = "N_SUPPLIER_ID", columnDefinition = "INTEGER")
    @MetaData(value = "供应商ID", comments = "供应商ID")
    private Long supplierId;

    /**
     * 核心企业名称
     */
    @Column(name = "C_CORE_COMPANY_NAME", columnDefinition = "VARCHAR")
    @MetaData(value = "核心企业名称", comments = "核心企业名称")
    private String coreCompanyName;

    /**
     * 核心企业ID
     */
    @Column(name = "N_CORE_COMPANY_ID", columnDefinition = "INTEGER")
    @MetaData(value = "核心企业ID", comments = "核心企业ID")
    private Long coreCompanyId;

    /**
     * 资金提供方
     */
    @Column(name = "C_FUND_PROVIDER_NAME", columnDefinition = "VARCHAR")
    @MetaData(value = "资金提供方", comments = "资金提供方")
    private String fundProviderName;

    /**
     * 资金提供方ID
     */
    @Column(name = "N_FUND_PROVIDER_ID", columnDefinition = "INTEGER")
    @MetaData(value = "资金提供方ID", comments = "资金提供方ID")
    private Long fundProviderId;

    /**
     * 合同签订日期
     */
    @Column(name = "D_CONTRACT_SIGNING_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "合同签订日期", comments = "合同签订日期")
    private Timestamp contractSigningDate;

    /**
     * 放款金额
     */
    @Column(name = "N_LOAN_AMOUNT", columnDefinition = "DECIMAL")
    @MetaData(value = "放款金额", comments = "放款金额")
    private BigDecimal loanAmount;

    /**
     * 放款日期
     */
    @Column(name = "D_LOAN_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "放款日期", comments = "放款日期")
    private Timestamp loanDate;

    /**
     * -1没完成(默认)，0完成，1部分完成，2逾期
     */
    @Column(name = "C_STATUS", columnDefinition = "CHAR")
    @MetaData(value = "-1没完成(默认)", comments = "-1没完成(默认)，0完成，1部分完成，2逾期")
    private String status;

    /**
     * 创建时间
     */
    @Column(name = "D_CREATE_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "创建时间", comments = "创建时间")
    private Timestamp createDate;

    /**
     * 创建人
     */
    @Column(name = "C_CREATOR", columnDefinition = "VARCHAR")
    @MetaData(value = "创建人", comments = "创建人")
    private String creator;

    /**
     * 创建人ID
     */
    @Column(name = "N_CREATOR_ID", columnDefinition = "INTEGER")
    @MetaData(value = "创建人ID", comments = "创建人ID")
    private Long creatorId;

    /**
     * 最后更新时间
     */
    @Column(name = "D_UPDATE_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "最后更新时间", comments = "最后更新时间")
    private Timestamp updateDate;

    /**
     * 最后更新人
     */
    @Column(name = "C_UPDATE_CREATOR", columnDefinition = "VARCHAR")
    @MetaData(value = "最后更新人", comments = "最后更新人")
    private String updateCreator;

    /**
     * 最后更新人ID
     */
    @Column(name = "N_UPDATE_CREATOR_ID", columnDefinition = "INTEGER")
    @MetaData(value = "最后更新人ID", comments = "最后更新人ID")
    private Long updateCreatorId;

    // 查询条件及返回数据
    private Timestamp startDate;// 放款开始日期
    private Timestamp endDate;// 放款开始结束日期
    private BigDecimal repaymentInterest;// 还息金额
    private BigDecimal repaymentPrincipal;// 还本金额
    private Timestamp repaymentInterestDate;// 还息日期
    private Timestamp repaymentPrincipalDate;// 还本日期

    private static final long serialVersionUID = 1337382223211608344L;

    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public Long getContractId() {
        return contractId;
    }

    public void setContractId(final Long contractId) {
        this.contractId = contractId;
    }

    public String getContractName() {
        return contractName;
    }

    public void setContractName(final String contractName) {
        this.contractName = contractName;
    }

    public String getContractNo() {
        return contractNo;
    }

    public void setContractNo(final String contractNo) {
        this.contractNo = contractNo;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(final String supplierName) {
        this.supplierName = supplierName;
    }

    public String getSupplierNo() {
        return supplierNo;
    }

    public void setSupplierNo(final String supplierNo) {
        this.supplierNo = supplierNo;
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(final Long supplierId) {
        this.supplierId = supplierId;
    }

    public String getCoreCompanyName() {
        return coreCompanyName;
    }

    public void setCoreCompanyName(final String coreCompanyName) {
        this.coreCompanyName = coreCompanyName;
    }

    public Long getCoreCompanyId() {
        return coreCompanyId;
    }

    public void setCoreCompanyId(final Long coreCompanyId) {
        this.coreCompanyId = coreCompanyId;
    }

    public String getFundProviderName() {
        return fundProviderName;
    }

    public void setFundProviderName(final String fundProviderName) {
        this.fundProviderName = fundProviderName;
    }

    public Long getFundProviderId() {
        return fundProviderId;
    }

    public void setFundProviderId(final Long fundProviderId) {
        this.fundProviderId = fundProviderId;
    }

    public Timestamp getContractSigningDate() {
        return contractSigningDate;
    }

    public void setContractSigningDate(final Timestamp contractSigningDate) {
        this.contractSigningDate = contractSigningDate;
    }

    public BigDecimal getLoanAmount() {
        return loanAmount;
    }

    public void setLoanAmount(final BigDecimal loanAmount) {
        this.loanAmount = loanAmount;
    }

    public Timestamp getLoanDate() {
        return loanDate;
    }

    public void setLoanDate(final Timestamp loanDate) {
        this.loanDate = loanDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(final String status) {
        this.status = status;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(final Timestamp createDate) {
        this.createDate = createDate;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(final String creator) {
        this.creator = creator;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(final Long creatorId) {
        this.creatorId = creatorId;
    }

    public Timestamp getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(final Timestamp updateDate) {
        this.updateDate = updateDate;
    }

    public String getUpdateCreator() {
        return updateCreator;
    }

    public void setUpdateCreator(final String updateCreator) {
        this.updateCreator = updateCreator;
    }

    public Long getUpdateCreatorId() {
        return updateCreatorId;
    }

    public void setUpdateCreatorId(final Long updateCreatorId) {
        this.updateCreatorId = updateCreatorId;
    }

    public Timestamp getStartDate() {
        return this.startDate;
    }

    public void setStartDate(final Timestamp anStartDate) {
        this.startDate = anStartDate;
    }

    public Timestamp getEndDate() {
        return this.endDate;
    }

    public void setEndDate(final Timestamp anEndDate) {
        this.endDate = anEndDate;
    }

    public BigDecimal getRepaymentInterest() {
        return this.repaymentInterest;
    }

    public void setRepaymentInterest(final BigDecimal anRepaymentInterest) {
        this.repaymentInterest = anRepaymentInterest;
    }

    public BigDecimal getRepaymentPrincipal() {
        return this.repaymentPrincipal;
    }

    public void setRepaymentPrincipal(final BigDecimal anRepaymentPrincipal) {
        this.repaymentPrincipal = anRepaymentPrincipal;
    }

    public Timestamp getRepaymentInterestDate() {
        return this.repaymentInterestDate;
    }

    public void setRepaymentInterestDate(final Timestamp anRepaymentInterestDate) {
        this.repaymentInterestDate = anRepaymentInterestDate;
    }

    public Timestamp getRepaymentPrincipalDate() {
        return this.repaymentPrincipalDate;
    }

    public void setRepaymentPrincipalDate(final Timestamp anRepaymentPrincipalDate) {
        this.repaymentPrincipalDate = anRepaymentPrincipalDate;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", contractId=").append(contractId);
        sb.append(", contractName=").append(contractName);
        sb.append(", contractNo=").append(contractNo);
        sb.append(", supplierName=").append(supplierName);
        sb.append(", supplierNo=").append(supplierNo);
        sb.append(", supplierId=").append(supplierId);
        sb.append(", coreCompanyName=").append(coreCompanyName);
        sb.append(", coreCompanyId=").append(coreCompanyId);
        sb.append(", fundProviderName=").append(fundProviderName);
        sb.append(", fundProviderId=").append(fundProviderId);
        sb.append(", contractSigningDate=").append(contractSigningDate);
        sb.append(", loanAmount=").append(loanAmount);
        sb.append(", loanDate=").append(loanDate);
        sb.append(", status=").append(status);
        sb.append(", createDate=").append(createDate);
        sb.append(", creator=").append(creator);
        sb.append(", creatorId=").append(creatorId);
        sb.append(", updateDate=").append(updateDate);
        sb.append(", updateCreator=").append(updateCreator);
        sb.append(", updateCreatorId=").append(updateCreatorId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(final Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        final LoanData other = (LoanData) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getContractId() == null ? other.getContractId() == null
                        : this.getContractId().equals(other.getContractId()))
                && (this.getContractName() == null ? other.getContractName() == null
                        : this.getContractName().equals(other.getContractName()))
                && (this.getContractNo() == null ? other.getContractNo() == null
                        : this.getContractNo().equals(other.getContractNo()))
                && (this.getSupplierName() == null ? other.getSupplierName() == null
                        : this.getSupplierName().equals(other.getSupplierName()))
                && (this.getSupplierNo() == null ? other.getSupplierNo() == null
                        : this.getSupplierNo().equals(other.getSupplierNo()))
                && (this.getSupplierId() == null ? other.getSupplierId() == null
                        : this.getSupplierId().equals(other.getSupplierId()))
                && (this.getCoreCompanyName() == null ? other.getCoreCompanyName() == null
                        : this.getCoreCompanyName().equals(other.getCoreCompanyName()))
                && (this.getCoreCompanyId() == null ? other.getCoreCompanyId() == null
                        : this.getCoreCompanyId().equals(other.getCoreCompanyId()))
                && (this.getFundProviderName() == null ? other.getFundProviderName() == null
                        : this.getFundProviderName().equals(other.getFundProviderName()))
                && (this.getFundProviderId() == null ? other.getFundProviderId() == null
                        : this.getFundProviderId().equals(other.getFundProviderId()))
                && (this.getContractSigningDate() == null ? other.getContractSigningDate() == null
                        : this.getContractSigningDate().equals(other.getContractSigningDate()))
                && (this.getLoanAmount() == null ? other.getLoanAmount() == null
                        : this.getLoanAmount().equals(other.getLoanAmount()))
                && (this.getLoanDate() == null ? other.getLoanDate() == null
                        : this.getLoanDate().equals(other.getLoanDate()))
                && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
                && (this.getCreateDate() == null ? other.getCreateDate() == null
                        : this.getCreateDate().equals(other.getCreateDate()))
                && (this.getCreator() == null ? other.getCreator() == null
                        : this.getCreator().equals(other.getCreator()))
                && (this.getCreatorId() == null ? other.getCreatorId() == null
                        : this.getCreatorId().equals(other.getCreatorId()))
                && (this.getUpdateDate() == null ? other.getUpdateDate() == null
                        : this.getUpdateDate().equals(other.getUpdateDate()))
                && (this.getUpdateCreator() == null ? other.getUpdateCreator() == null
                        : this.getUpdateCreator().equals(other.getUpdateCreator()))
                && (this.getUpdateCreatorId() == null ? other.getUpdateCreatorId() == null
                        : this.getUpdateCreatorId().equals(other.getUpdateCreatorId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getContractId() == null) ? 0 : getContractId().hashCode());
        result = prime * result + ((getContractName() == null) ? 0 : getContractName().hashCode());
        result = prime * result + ((getContractNo() == null) ? 0 : getContractNo().hashCode());
        result = prime * result + ((getSupplierName() == null) ? 0 : getSupplierName().hashCode());
        result = prime * result + ((getSupplierNo() == null) ? 0 : getSupplierNo().hashCode());
        result = prime * result + ((getSupplierId() == null) ? 0 : getSupplierId().hashCode());
        result = prime * result + ((getCoreCompanyName() == null) ? 0 : getCoreCompanyName().hashCode());
        result = prime * result + ((getCoreCompanyId() == null) ? 0 : getCoreCompanyId().hashCode());
        result = prime * result + ((getFundProviderName() == null) ? 0 : getFundProviderName().hashCode());
        result = prime * result + ((getFundProviderId() == null) ? 0 : getFundProviderId().hashCode());
        result = prime * result + ((getContractSigningDate() == null) ? 0 : getContractSigningDate().hashCode());
        result = prime * result + ((getLoanAmount() == null) ? 0 : getLoanAmount().hashCode());
        result = prime * result + ((getLoanDate() == null) ? 0 : getLoanDate().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
        result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
        result = prime * result + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode());
        result = prime * result + ((getUpdateCreator() == null) ? 0 : getUpdateCreator().hashCode());
        result = prime * result + ((getUpdateCreatorId() == null) ? 0 : getUpdateCreatorId().hashCode());
        return result;
    }
}